#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <Dynamics/Integrator/symplectic_euler_cuda.h>
#include <string>
using namespace PhysLeo;
namespace py = pybind11;

template<typename T>
static void declareSymplecticEulerCpu(py::module &mod, const std::string &typestr)
{
    using class_type = SymplecticEulerCpu<T>;
    using base_type = Integrator<T>;
    auto pyclass_name = std::string("SymplecticEulerCpu") + typestr;
    py::class_<class_type, base_type, std::shared_ptr<class_type>>cls(mod, pyclass_name.c_str());

    cls.def(py::init());
    cls.def("allocateResource", &class_type::allocateResource);
    cls.def("advanceTime", &class_type::advanceTime);
}

template<typename T>
static void declareSymplecticEulerCuda(py::module &mod, const std::string &typestr)
{
    using class_type = SymplecticEulerCuda<T>;
    using base_type = SymplecticEulerCpu<T>;
    auto pyclass_name = std::string("SymplecticEulerCuda") + typestr;
    py::class_<class_type, base_type, std::shared_ptr<class_type>>cls(mod, pyclass_name.c_str());

    cls.def(py::init());
    cls.def("advanceTime", &class_type::advanceTime);
}

void initSymplecticEuler(py::module &m)
{
    declareSymplecticEulerCpu<float>(m, std::string("F"));
    declareSymplecticEulerCpu<double>(m, std::string("D"));

    declareSymplecticEulerCuda<float>(m, std::string("F"));
    declareSymplecticEulerCuda<double>(m, std::string("D"));
}
